package com.qs.tx.service.impl;

import com.qs.tx.entity.Account;
import com.qs.tx.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service(value = "accountService")
public class AccountServiceImpl implements AccountService {

	@Autowired
	private JdbcTemplate jdbcTemplate;

	@Transactional
	@Override
	public void insertAccount(Account account) {
		String sql = "insert into t_account(account_name,amount,create_time) values(?,?,now())";
		int cnt = jdbcTemplate.update(sql, new Object[]{account.getAccountName(), account.getAmount()});
		System.out.println("成功执行：" + cnt + "条！");
		int i = 1/0;
	}

	@Override
	public void updateAccount(Account account) {
	}
}
